package com.xiaomi.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.math.BigDecimal;

import lombok.Data;
import lombok.Getter;
import lombok.Setter;
/**
 * @author： YongZ
 * @date： 2024/5/29
 * @description：
 * @modifiedBy：
 */


/**
 * @TableName user
 */
@TableName(value = "user")
@Data
public class User implements Serializable {
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @Getter
    @Setter
    private String username;

    @Getter
    @Setter
    private String password;


    private static final long serialVersionUID = 1L;


    /**
     *
     * @TableName phones
     */
    @TableName(value ="phones")
    @Data
    public static class Phones implements Serializable {
        /**
         *
         */
        @TableId(type = IdType.AUTO)
        private Integer id;

        /**
         *
         */
        private String name;

        /**
         *
         */
        private BigDecimal price;

        /**
         *
         */
        private String src;

        @TableField(exist = false)
        private static final long serialVersionUID = 1L;

        @Override
        public boolean equals(Object that) {
            if (this == that) {
                return true;
            }
            if (that == null) {
                return false;
            }
            if (getClass() != that.getClass()) {
                return false;
            }
            Phones other = (Phones) that;
            return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
                && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
                && (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice()))
                && (this.getSrc() == null ? other.getSrc() == null : this.getSrc().equals(other.getSrc()));
        }

        @Override
        public int hashCode() {
            final int prime = 31;
            int result = 1;
            result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
            result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
            result = prime * result + ((getPrice() == null) ? 0 : getPrice().hashCode());
            result = prime * result + ((getSrc() == null) ? 0 : getSrc().hashCode());
            return result;
        }

        @Override
        public String toString() {
            StringBuilder sb = new StringBuilder();
            sb.append(getClass().getSimpleName());
            sb.append(" [");
            sb.append("Hash = ").append(hashCode());
            sb.append(", id=").append(id);
            sb.append(", name=").append(name);
            sb.append(", price=").append(price);
            sb.append(", src=").append(src);
            sb.append(", serialVersionUID=").append(serialVersionUID);
            sb.append("]");
            return sb.toString();
        }
    }
}
